package ui;

/**
This is a general overview on how the GuiPlugin is supposed to work:<br>

Creation of GuiPlugin<br>
Gui is passed a lock object<br>
	This object is to be used to tell Phrox that there is input from the user<br>
Gui is made visible gui_display(true)<br>
Phrox then waits for input / starts sending output to the gui<br>
	Note that in/out put are sent asychronously from each other,<br>
	meaning that there can be no race conditions within the GuiPlugin<br>
	that will cause issues if input or output is given first<br>
	
Waiting for input:
	Phrox waits by using the Object.waitFor() method<br>
	And should be told there is input using the Object.notify() method<br>
	Phrox will then query the GuiPlugin for input<br>

Waiting for output:
	Phrox will call whatever method is associated to the desired output type
		No sort of waiting should be used inside the GuiPlugin

 */
public interface GuiPlugin {


	
	
		/**
		 * Used to set the title of the gui
		 */
		public void gui_setTitle(String str);
		/*
		 * {
		 * JFrame.setTitle(str);
		 * }
		 */
	
		/**
		 * This is used by Phrox to tell the gui that the user could be lagging.
		 * @param b 1 if the user is lagging. 0 if the user is not, or no longer lagging.
		 * -1 for no longer in use. and any others can be used for other things.
		 */
		//TODO : change the parameter to int? and amount of time the user has been lagging (in milliseconds)?
		public void gui_hasLag(byte b);
		
		/**
		 * Adds text to the chat box that the user sees.
		 * @param str text to add to chat box
		 */
		public void chat_AddText(String str);
		/*
		 * {
		 * 	//conversationArea is a JTextArea
		 * 	String in = conversationArea.getText();
		 * 	conversationArea.setText(in +"\n"+ str);
		 * 
		 * 	//AutoScroll:
		 * 	conversationArea.setCaretPosition(conversationArea.getText().length());
		 * 
		 * }
		 */
		
		
		/**
		 * Clear the text of the chat box
		 */
		public void chat_ClearText();
		/*
		 * {
		 *	//conversationArea is a JTextArea
		 * 	conversationArea.setText("");
		 * }
		 */
		
		/*
		 * don't need this
		 * @return returns the contents of the chat box.
		 * 
		 */
		//public String chat_getText();
		
		
		/**
		 * @return String, returns text from the user (msg box)
		 */
		public String type_GetText();
		/*
		 * {
		 * 	
		 * 	//out is a global String object, accessible from anywhere in the class
		 * 	
		 *	String send = out;//copy out.
		 *	out = null;//reset out, so we don't return it twice.
		 *	//set has text to false
		 *	
		 *	booleanFlagForText=false;//pick a shorter name?
		 *	
		 *	return send;
		 * 	
		 * }
		 */
		
		/**
		 * @param s, set the users msg box to string s.
		 */
		public void type_SetText(String s);
		
		/**
		 * If the text object has a bunch of text, set a boolean flag.
		 */
		public boolean type_hasText();
		
		
		
		/**
		 * DOESN'T NEED TO DO ANYTHING
		 * @param str set the users username to String, shows up on gui, 
		 */
		public void userName_SetText(String str);
		/*
		 *{
		 *	//userField is a JTextArea
		 * 
		 *	userField.setText(str);
		 * 
		 *}
		 */
		
		/**
		 * Get's the gui's state as bit flags
		 * <br>1 : gui is usable (can be opened by gui_display(true) )
		 * <br> should be true until gui_dispose has been called
		 * <br>2 : gui is visible ( can be used by the user to input text, or view Phrox output )
		 * <br>
		 */
		//public byte gui_getState();
		
		/**
		 * Passes the GuiPlugin an object to lock on for giving Phrox user input, will only get called once
		 */
		//public void gui_setLock(Object o);
		
		/**
		 * Disposes of the Gui.
		 */
		public void gui_dispose();
		/*
		 * {
		 * 	JFrame.dispose();
		 * }
		 */

		/**
		 * Gui exists? Wasn't closed by pressing 'x' button.
		 */
		public boolean gui_displayable();
		/*
		 * {
		 * 	//return a variable that holds gui state, set var to true when gui is closed
		 * }
		 */
		
		/**
		 * Whether or not to show the Gui
		 * <br>True: show gui
		 * <br>false: hide gui
		 * <br> 
		 */
		public void gui_display(boolean b);

}
